package request

import "github.com/astaxie/beego/validation"

type ScheduleJobServiceRequest struct {
	BeanName       string `json:"beanName"`
	MethodName     string `json:"methodName"`
	Params         string `json:"params"`
	CronExpression string `json:"cronExpression"`
	Remark         string `json:"remark"`
}

func (s *ScheduleJobServiceRequest) Valid(v *validation.Validation) {
	if s.BeanName == "" {
		v.SetError("BeanName", "bean名称不能为空")
	} else if s.MethodName == "" {
		v.SetError("MethodName", "方法名称不能为空")
	} else if s.CronExpression == "" {
		v.SetError("CronExpression", "cron表达式不能为空")
	}
}
